package com.itheima.tlias84.Service.impl;

import com.github.pagehelper.Page;
import com.github.pagehelper.PageHelper;
import com.itheima.tlias84.Po.SelectLogPageParam;
import com.itheima.tlias84.Service.LogService;
import com.itheima.tlias84.Util.ResultUtil;
import com.itheima.tlias84.entity.Log;
import com.itheima.tlias84.mapper.LogMapper;
import com.itheima.tlias84.vo.PageVO;
import jakarta.annotation.Resource;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class LogServiceImpl implements LogService {
    @Resource
    LogMapper logMapper;
    @Override
    public ResultUtil listLogsByPage(SelectLogPageParam param) {
        Page<Object> page = PageHelper.startPage(param.getPage(), param.getPageSize());
        List<Log> logs = logMapper.listLogsByPage(param);
        PageVO<Log> pageVO = new PageVO<>();
        pageVO.setTotal(page.getTotal());
        pageVO.setRows(logs);
        return ResultUtil.success(pageVO);
    }


}
